using System.Linq;
using Sustainalytics.ESGRatings.Computing.Service.Validators;
using Sustainalytics.ESGRatings.DataContract;
using System.Collections.Generic;

namespace Sustainalytics.ESGRatings.Computing.Service.Extensions
{
    public static class ValidationExtensions
    {
        public static bool Validate(this ESGDataContainer entity, out ICollection<string> brokenRules)
        {
            IValidator<ESGDataContainer> validator = new DataSetValidator();
            brokenRules = validator.BrokenRules(entity);
            return brokenRules.Any();
        }

        public static bool Validate(this GovernanceDataContainer entity, out ICollection<string> brokenRules)
        {
            IValidator<GovernanceDataContainer> validator = new GovernanceDataSetValidator();
            brokenRules = validator.BrokenRules(entity);
            return brokenRules.Any();
        }
    }
}